package com.hh;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

@Service
public class ContextHolder implements InitializingBean {

    @Autowired
    ApplicationContext context;

    static ContextHolder instance;

    public static ApplicationContext getContext() {
        return instance.context;
    }



    @Override
    public void afterPropertiesSet() throws Exception {
        instance = this;
    }
}
